package exception;

import java.io.FileNotFoundException;

/**
抛出异常
 */
public class ThrowDemo {
    public static void main(String[] args) throws IllegalAgeException {
        Student zs=new Student();
        System.out.println("Please set the student's age:");
        try {
            zs.setAge(250);
        } catch (IllegalAgeException e) {
//            System.out.println(e.getMessage());
            e.printStackTrace();
        }
        System.out.println("Zhangsan's age is:"+zs.getAge()+" years old");
    }
}
